home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / e-lang / bguiv412.lha / BGUI_Ev41_2 / sources / List1.e < prev    next >
Text File  |  1996-05-01  |  8KB  |  194 lines

  1. /*
  2. **      List1.e
  3. **
  4. **      (C) Copyright 1995-1996 Jaba Development.
  5. **      (C) Copyright 1995-1996 Jan van den Baard.
  6. **          All Rights Reserved.
  7. **
  8. **      Modified by Dominique Dutoit, 5/1/96
  9. */
  10.  
  11. OPT OSVERSION=37
  12. OPT PREPROCESS
  13.  
  14. MODULE 'libraries/bgui',
  15.        'libraries/bgui_macros',
  16.        'libraries/gadtools',
  17.        'bgui',
  18.        'tools/boopsi',
  19.        'utility/tagitem',
  20.        'intuition/classes',
  21.        'intuition/classusr',
  22.        'intuition/gadgetclass'
  23.  
  24. /*
  25.  *      Object ID's.
  26.  */
  27. CONST   ID_QUIT= 1
  28.  
  29. /*
  30.  *      Simple button creation macros.
  31.  */
  32. #define FuzzButton(label,id)\
  33.     ButtonObject,\
  34.         LAB_LABEL,              label,\
  35.         LAB_UNDERSCORE,         "_",\
  36.         GA_ID,                  id,\
  37.         FuzzButtonFrame,\
  38.     EndObject
  39.  
  40. PROC main()
  41.         DEF window
  42.         DEF wo_window, tabs, page
  43.         DEF signal = 0, rc
  44.         DEF running = TRUE
  45.         DEF entries
  46.  
  47.         entries := [ 'Entry 1',
  48.                      'Entry 2',
  49.                      'Entry 3',
  50.                      'Entry 4',
  51.                      'Entry 5',
  52.                      'Entry 6',
  53.                      'Entry 7',
  54.                      'Entry 8',
  55.                      'Entry 9',
  56.                      'Entry 10',
  57.                      'Entry 11',
  58.                      'Entry 12',
  59.                      'Entry 13',
  60.                      'Entry 14',
  61.                      'Entry 15',
  62.                      'Entry 16',
  63.                      'Entry 17',
  64.                      'Entry 18',
  65.                      'Entry 19',
  66.                      'Entry 20',
  67.                      NIL ]
  68.  
  69.         /*
  70.         **      Open the library.
  71.         **/
  72.         IF bguibase := OpenLibrary( 'bgui.library', 41 )
  73.                 /*
  74.                 **      Build the window object tree.
  75.                 **/
  76.                 wo_window := WindowObject,
  77.                         WINDOW_TITLE,           'Listview DragNDrop',
  78.                         WINDOW_SCALEWIDTH,      25,
  79.                         WINDOW_SCALEHEIGHT,     20,
  80.                         WINDOW_RMBTRAP,         TRUE,
  81.                         WINDOW_AUTOASPECT,      TRUE,
  82.                         WINDOW_AUTOKEYLABEL,    TRUE,
  83.                         WINDOW_MASTERGROUP,
  84.                             VGroupObject, VOffset( 6 ), Spacing( 6 ),
  85.                                 StartMember,
  86.                                     tabs := Tabs( NIL, [ 'Single-Select', 'Multi-Select', NIL ], 0, 0),
  87.                                 EndMember,
  88.                                 StartMember,
  89.                                     page := PageObject,
  90.                                     PageMember,
  91.                                         VGroupObject, HOffset( 6 ), Spacing( 6 ),
  92.                                             StartMember,
  93.                                                 InfoFixed( NIL, '\ecSingle-Select Drag-n-Drop\nListview object.', NIL, 2), FixMinHeight,
  94.                                             EndMember,
  95.                                             StartMember,
  96.                                                 /*
  97.                                                  *  Create a draggable and droppable listview
  98.                                                  *  and make it show the drop-spot.
  99.                                                  */
  100.                                                 ListviewObject,
  101.                                                     LISTV_ENTRYARRAY,       entries,
  102.                                                     LISTV_SHOWDROPSPOT,     TRUE,
  103.                                                     BT_DRAGOBJECT,          TRUE,
  104.                                                     BT_DROPOBJECT,          TRUE,
  105.                                                 EndObject,
  106.                                             EndMember,
  107.                                         EndObject,
  108.                                     PageMember,
  109.                                         VGroupObject, HOffset( 6 ), Spacing( 6 ),
  110.                                             StartMember,
  111.                                                 InfoFixed( NIL, '\ecMulti-Select Drag-n-Drop\nListview object.', NIL, 2 ), FixMinHeight,
  112.                                             EndMember,
  113.                                             StartMember,
  114.                                             /*
  115.                                              *  Create a multi-select, draggable and
  116.                                              *  droppable listview and make it show
  117.                                              *  the drop-spot.
  118.                                              */
  119.                                                 ListviewObject,
  120.                                                     LISTV_MULTISELECT,  TRUE,
  121.                                                     LISTV_ENTRYARRAY,   entries,
  122.                                                     LISTV_SHOWDROPSPOT, TRUE,
  123.                                                     BT_DRAGOBJECT,      TRUE,
  124.                                                     BT_DROPOBJECT,      TRUE,
  125.                                                 EndObject,
  126.                                             EndMember,
  127.                                         EndObject,
  128.                                     EndObject,
  129.                                 EndMember,
  130.                                 StartMember,
  131.                                     HGroupObject,
  132.                                         VarSpace( DEFAULT_WEIGHT ),
  133.                                         StartMember, FuzzButton( '_Quit', ID_QUIT ), EndMember,
  134.                                         VarSpace( DEFAULT_WEIGHT ),
  135.                                     EndObject, FixMinHeight,
  136.                                 EndMember,
  137.                             EndObject,
  138.                     EndObject
  139.  
  140.                 /*
  141.                 **      Object created OK?
  142.                 **/
  143.                 IF ( wo_window )
  144.                         /*
  145.                         **  Connect the cycle to page.
  146.                         */
  147.                         AddMap( tabs, page, [ MX_ACTIVE, PAGE_ACTIVE, TAG_END ] )
  148.                         /*
  149.                         **      Open up the window.
  150.                         **/
  151.                         IF ( window := WindowOpen( wo_window ) )
  152.                                 /*
  153.                                 **      Obtain signal mask.
  154.                                 **/
  155.                                 GetAttr( WINDOW_SIGMASK, wo_window, {signal} )
  156.                                 /*
  157.                                 **      Poll messages.
  158.                                 **/
  159.                                 WHILE running = TRUE
  160.                                         /*
  161.                                         **      Wait for the signal.
  162.                                         **/
  163.                                         Wait( signal )
  164.                                         /*
  165.                                         **      Call uppon the event handler.
  166.                                         **/
  167.                                         WHILE ( rc := HandleEvent( wo_window )) <> WMHI_NOMORE
  168.                                                 SELECT rc
  169.                                                         CASE    WMHI_CLOSEWINDOW
  170.                                                                 running := FALSE
  171.                                                         CASE    ID_QUIT
  172.                                                                 running := FALSE
  173.                                                 ENDSELECT
  174.                                         ENDWHILE
  175.                                 ENDWHILE
  176.                         ELSE
  177.                             WriteF( 'Unable to open the window\n' )
  178.                         ENDIF
  179.                         /*
  180.                         **      Disposing of the object
  181.                         **      will automatically close the window
  182.                         **      and dispose of all objects that
  183.                         **      are attached to the window.
  184.                         **/
  185.                         DisposeObject( wo_window )
  186.                 ELSE
  187.                         WriteF( 'Unable to create a window object\n' )
  188.                 ENDIF
  189.                 CloseLibrary(bguibase)
  190.         ELSE
  191.                 WriteF( 'Unable to open the bgui.library\n' )
  192.         ENDIF
  193. ENDPROC NIL
  194.